
package com.example.paper.common.datam.userStudentJob;

import com.example.paper.common.datam.migrate.reader.BaseReader;
import com.example.paper.common.datam.migrate.reader.CommonBlock;
import com.example.paper.common.datam.service.impl.UserStuentService;
import com.example.paper.common.entity.UserStudent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 描述.
 *
 * @author Long Fengfan, 2022年10月17日

 */

@Component
public class UserStudentReader extends BaseReader<UserStudent> {

    @Autowired
    private UserStuentService userStuent2Service;

    @Override
    public long getTotalCount(Map<String, Object> readerParams) {
        return userStuent2Service.countByMapParam(readerParams);
    }

    @Override
    public List<UserStudent> doRead(Map<String, Object> readerParams, CommonBlock commonBlock) {
        return userStuent2Service.getPageList(readerParams, "ID", commonBlock.getSegment(), commonBlock.getPageSize());
    }

    @Override
    public int getBatchSize() {
        return 10;
    }
}
